
#ifndef _MEMBER_BSLIDERRESTRAINT_H_
#define _MEMBER_BSLIDERRESTRAINT_H_

#include <BLineStripe>
#include <BSplineCurve>
#include <BSliderRestraint>

#define slider_member(slider)		((member_BSliderRestraint*)((BSliderRestraint*)slider)->_ptr)

namespace BWE
{
	class member_BSliderRestraint : public BObject
	{
		friend BSliderRestraint;
	public:
		member_BSliderRestraint(BSliderRestraint* sliderRestraint);
		~member_BSliderRestraint();

		void linearCaculate();
		BReal linearMotorFactor(BReal stepTime);

		void angularCaculate();
		BReal angularMotorFactor(BReal stepTime);

		void slotLineStripeFlushed(BObject* object, const BValue& value);
		void slotSplineCurveFlushed(BObject* object, const BValue& value);

	public:
		BSliderRestraint*		boss;
		BHolder<BLineStripe>	stripe;
		BHolder<BSplineCurve>	curve;

		BVector			axisA;
		BVector			axisB;
		BRealRange		linearLimit;
		BRealRange		angularLimit;

		bool			linearLimited;
		BReal			linearDiff;
		BReal			linearPos;

		bool			angularLimited;
		BVector			horAxis;
		BVector			verAxis;
		BVector			dirAxis;
		BVector			swingAxis;
		BReal			angularDiff;
		BReal			angularPos;

		bool			linearMotorEnabled;
		BReal			linearMotorTarget;
		BReal			linearMotorVelocity;
		BReal			linearMotorMaxForce;
		bool			linearMotorReached;

		bool			angularMotorEnabled;
		BReal			angularMotorTarget;
		BReal			angularMotorVelocity;
		BReal			angularMotorMaxForce;
		bool			angularMotorReached;

	};
}

#endif
